<#assign module="marketing"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/datepicker/datepicker.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">
<div class="row">
 	<div class="col-xs-12">
	</div>
</div>
<div class="row margin-top">
	<div class="col-xs-12">
	<div class="table-responsive">
	
	<div class="panel panel-default">
		<div class="panel-heading">
			${activity.activityEventName?if_exists}&nbsp;&nbsp;
			<#if activity.stoped>
				(已停止)
			<#else>
				<#if activity.timeStatus==0>
					(未开始)
				<#elseif activity.timeStatus==1>
					(进行中)
				<#elseif activity.timeStatus==2>
					(已过期)
				</#if>
			</#if>
			<a class="btn btn-default btn-xs" href="JavaScript:window.history.go(-1);">返回</a>
	    </div>
    </div>
    
    <div class="row margin-top">
		<div class="col-xs-12">
			<form class="form-inline" role="form" >
				<@shiro.isMainCompany>
					<select class="form-control" name="companyId" id="companyId">
						<option value="">全部</option>
			  			<#list companys as company>
			  				<option value="${company.id}" <#if companyId?? && companyId==company.id>selected="selected"</#if>>${company.abbreviation}</option>
			  			</#list>
		  			</select>
  				</@shiro.isMainCompany>
		  		<div class="form-group">
		  			<input type="text" class="form-control" id="phone"  name="phone" placeholder="输入手机号" value="${phone?if_exists}"  >
		  		</div>
		  		
		  		
		  		<div class="input-group">
					<input id="startTime" name="startTime" type="text" class="form-control" placeholder="开始时间" value="${startTime?if_exists}"  />
				</div>
				
			  	<div class="form-group">
			  		<input id="endTime" name="endTime" type="text" class="form-control"  placeholder="结束时间" value="${endTime?if_exists}" />
			    </div>
			    
			    
			    <div class="form-group">
			        <button type="submit" id="search_button" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i> 查询</button>
			    </div>
		    </form>
	    </div>
    </div>
    
	<div class="panel panel-default margin-top">
		
		<table class="table table-hover table-striped">
			<thead>
			<tr style="font-size:14px;">
				<th style="width:100px;">所属公司</th>
				<th style="width:100px;">客户名称</th>
				<th style="width:100px;">客户电话</th>
				<th style="width:200px;">时间</th>
				<th style="width:100px;">金额</th>
				<th style="width:700px;">详情</th>
			</tr>
			</thead>
			<tbody>
				<#if (page.content)?? >
				  	<#list page.content as data>
						<tr>
							<td class="status-td">
								${data.companyName?if_exists}
							</td>
							<td class="status-td">
								${data.passengerName?if_exists}
							</td>
							<td>
								${data.passengerPhone?if_exists}
							</td>
							<td>
								${data.created?if_exists}
							</td>
							<td>
								<#if data.money!=0>
									<span style="color:#ff950b;font-weight:700;">
										${data.money?if_exists}元
									</span>
								<#else>
									-
								</#if>
							</td>
							<td>
								${data.memo?if_exists}
							</td>
						</tr>
					</#list>
				</#if>
			</tbody>
		</table>
		<#if page.totalElements??>
		<ul class="pagination pull-right pagination-sm">
			<#if activity.activityType=='cash'>
			<li><a>赠送金额：<#if sum??>${sum?if_exists}<#else>0</#if></a></li>
			<#elseif activity.activityType=='coupon'>
			
			<li><a>领取优惠券数量：<#if sumAll??>${sumAll?if_exists}<#else>0</#if></a></li>
			</#if>
			<li><a>参与人次：${passengerAll?if_exists}</a></li>
			<li><a>共 ${page.totalElements} 条数据</a></li>
			<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/activity/detail/${activity.id}">
				<@pg.param name="companyId" value="${companyId?if_exists}"/>
				<@pg.param name="phone" value="${phone?if_exists}"/>
				<@pg.param name="startTime" value="${startTime?if_exists}"/>
				<@pg.param name="endTime" value="${endTime?if_exists}"/>
				<@pg.index>
					<@pg.first>
						<li><a href="${pageUrl}">&laquo;</a></li>
					</@pg.first>
					<@pg.prev>
						<li><a href="${pageUrl}">&lsaquo;</a></li>
					</@pg.prev>
					<@pg.pages>
						<#if  currentPageNumber == pageNumber >
							<li class="active"><a href="#">${pageNumber}</a></li>
						<#else>
							<li><a href="${pageUrl}">${pageNumber}</a></li>
						</#if>
					</@pg.pages>
					<@pg.next>
						<li><a href="${pageUrl}">&rsaquo;</a></li>
					</@pg.next>
					<@pg.last>
						<li><a href="${pageUrl}">&raquo;</a></li>
					</@pg.last>
				</@pg.index>
			</@pg.pager>
		</ul>
		</#if>
	</div>
	</div>
	</div>
</div>
</@override>
<@override name="footer">
<script src="${ctx}/assets/js/datepicker.js"></script>
<script type="text/javascript">
$("#startTime").datetimepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', minView: 'month', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
$("#endTime").datetimepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', minView: 'month', pickDate: true, pickTime: false, inputMask: false, autoclose: true });
</script>
</@override>
<@extends name="../layout.ftl"/>